<!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
        <style>
            *{
                margin: 0px;
                padding: 0px;
                list-style: none;
            }
            
            ul{
                overflow: hidden;
            }
            li{
                float: left;
                width:120px;
                text-align: center;
                height: 30px;
                line-height: 30px;
                cursor: pointer;
                border:1px solid black;
            }
            div{
                width:485px;
                height: 300px;
                line-height: 300px;
                text-align: center;
                border:1px solid black;
                display: none;
                color: red;
            }
            li.z{
                background: pink;
            }
            div.z{
                display: block;
            }
        </style>
    </head>
    <body>
        <ul>
            <li>一</li>
            <li>二</li>
            <li>三</li>
            <li>四</li>
        </ul>
    <section>
        <div class="z">内容一</div>
            <div>内容二</div>
            <div>内容三</div>
            <div>内容四</div>
    </section>
    <script>
        var t=document.getElementsByTagName('li');
        var b=document.getElementsByTagName('div');
        for(var i=0;i<t.length;i++){
            t[i].index=i;
            t[i].onclick=function(){
                for(var j=0;j<t.length;j++){
                    t[j].className='';
                    b[j].className='';
                }
                this.className='z';
                var n=this.index;
                b[n].className='z';
            }
        }
    </script>
    </body>
</html>